package com.springvn.sample.services;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import com.springvn.sample.config.BaseTestConfig;
import com.springvn.sample.init.Initializer;
import com.springvn.sample.init.WebAppConfig;
import com.springvn.sample.persistence.Employee2;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { BaseTestConfig.class })
public class EmployeeManagerTest2 {
	@Autowired
	private IEmployeeService2 employeeManager;

	@Test
	public void testAddEmployee() throws ParseException {

		SimpleDateFormat sdf = new SimpleDateFormat("yyyy, MM, dd");
		Date date = sdf.parse("2009, 12, 9");
		Employee2 employee = new Employee2(300026, "hoang", "doan", date, "M", date);

//		employeeManager.addEmployee(employee);
//		employeeManager.deleteEmployee(10001);
//		System.out.print(employeeManager.findById(300023));
		employeeManager.deleteEmployee(443);
		System.out.print(employeeManager.getAllEmployees().size());

	}

}
